package com.impress.provider;

import android.net.Uri;
import android.provider.BaseColumns;


/**
 * 
 * Define the Data related to the feed.(Table columns in the database)
 * <p>
 * items<br>
 * feeds<br>
 * labels<br>
 * item_label<br>
 * </p>
 * @author pluto
 * @version 1.0.1
 * @version 1.0.3 add summary and downloadState in items
 * @version 1.0.4 add preview_img
 */
public abstract class FeedData {
	
	public static final String AUTHORITY = "com.impress.provider.FeedData";
	
	public static final String TAG = "FeedData";
	
	private FeedData(){}
	
	/**
	 * define columns in table items.
	 * <p>
	 * Contains:_id(derived from base class)<br>
	 * atom_id<br>
	 * alternate_url<br>
	 * content<br>
	 * summary<br>
	 * title<br>
	 * feed_title<br>
	 * feed_id<br>
	 * read_state<br>
	 * starred_state<br>
	 * shared_state<br>
	 * like_state<br>
	 * download_State<br>
	 * update_timestamp<br>
	 * author<br>
	 * insert_timestamp<br>
	 * preview_img<br>
	 * </p>
	 */
	public static final class Items implements BaseColumns
	{
		private Items(){}
		
		/**
		 * the content uri of Item table
		 */
		public static final Uri CONTENT_URI = Uri.parse("content://"+AUTHORITY+"/items");
		
		/**
		 * MIME类型-多个
		 */
		public static final String CONTENT_TYPE = 
			"vnd.android.cursor.dir/vnd.google.FeedData.items";
		
		
		/**
		 * MIME类型-单个
		 */
		public static final String CONTENT_ITEM_TYPE =
			"vnd.android.cursor.item/vnd.google.FeedData.items";
		
		
		/**
		 * entry item 对应的atom_id
		 * <p>
		 * Type: TEXT e.g.(tag:google.com,2005:reader/item/fe2332323)
		 * </p>
		 */
		public static final String ATOM_ID = "Atom_ID";
		
		/**
		 * entry item的地址URL
		 * <p>
		 * Type: TEXT
		 * </p>
		 */
		public static final String ALTERNATE_URL = "Alternate_url";
		
		/**
		 * entry的正文部分
		 * <p>
		 * Type: TEXT
		 * </p>
		 */
		public static final String CONTENT = "Content";
		
		public static final String SUMMARY = "Summary";
		
		/**
		 * entry的标题
		 * <p>
		 * Type: TEXT
		 * </p>
		 */
		public static final String TITLE = "Title";
		
		/**
		 * feed的标题
		 * <p>
		 * Type: TEXT
		 * </p>
		 */
		public static final String FEED_TITLE = "Feed_title";
		
		public static final String FEED_ID = "Feed_ID";
		
		//TODO need to be changed of state field.
		
		/**
		 * entry 的状态，已读为1，未读为0
		 * <p>
		 * Type: INTEGER
		 * </p>
		 */
		public static final String READ_STATE = "Read_state";
		
		/**
		 * entry's modified state, read as 1, unread as 0.
		 * <p>
		 * Type: INTEGER
		 * </p>
		 */
		public static final String READ_STATE_PENDING = "Read_state_pending";
		
		/**
		 * 
		 */
		public static final String STARRED_STATE = "Starred_state";
		
		public static final String STARRED_STATE_PENDING = "Starred_state_pending";
		
		
		public static final String SHAREED_STATE = "Shared_state";
		
		public static final String SHAREED_STATE_PENDING = "Shared_state_pending";
		
		public static final String LIKED_STATE = "Liked_state";
		
		public static final String LIKED_STATE_PENDING = "Liked_state_pending";
		
		public static final String DOWNLOAD_STATE = "Download_state";
		
		/**
		 * 文章更新的时间
		 * <p>
		 * Type: INTEGER
		 * </p>
		 */
		public static final String UPDATE_TIMESTAMP = "Update_timestamp";
		
		public static final String AUTHOR = "Author";
		
		/**
		 * 插入到数据库的时间
		 * <p>
		 * Type: INTEGER
		 * </p>
		 */
		public static final String INSERT_TIMESTAMP = "Insert_timestamp";
		
		/**
		 * item的预览图
		 */
		public static final String PREVIEW_IMG = "Preview_img";
		
		/**
		 * 默认的排列顺序（降序）
		 */
		public static final String DEFAULT_SORT_ORDER = INSERT_TIMESTAMP+" DESC";
	}
	
	/**
	 * define columns in table feeds
	 * <p>
	 * Contains: _id(derived from base class)<br>
	 * atom_id<br>
	 * title<br>
	 * sort_id<br>
	 * </p>
	 */
	public static final class Feeds implements BaseColumns
	{
		private Feeds(){}
		
		/**
		 * content uri of feeds.
		 */
		public static final Uri CONTENT_URI = Uri.parse("content://"+AUTHORITY+"/feeds");
		
		/**
		 * MIME类型-多个
		 */
		public static final String CONTENT_TYPE = 
			"vnd.android.cursor.dir/vnd.google.feeds";
		
		/**
		 * MIME类型-单个
		 */
		public static final String CONTENT_ITEM_TYPE = 
			"vnd.android.cursor.item/vnd.google.feeds";
		
		/**
		 * feed对应的atom id.
		 * <p>
		 * Type: TEXT(e.g. /feed/http://...)
		 * </p>
		 */
		public static final String ATOM_ID = "Atom_ID";
		
		/**
		 * feed的标题
		 */
		public static final String TITLE = "Title";
		
		/**
		 * feed的sort顺序
		 * <p>
		 * Type: TEXT(16进制数 e.g.: FC52EC7F)
		 * </p>
		 */
		public static final String SORT_ID = "Sort_id";
		
		/**
		 * 默认排列顺序
		 */
		public static final String DEFAULT_SORT_ORDER = SORT_ID + " ASC";
	}

	/**
	 * define columns in table labels
	 * <p>
	 * Contains:_id(derived from base class)
	 * name
	 * sort_id
	 * </p>
	 *
	 */
	public static final class Labels implements BaseColumns
	{
		private Labels(){}
		
		public static final Uri CONTENT_URI = Uri.parse("content://"+AUTHORITY+"/labels");
		
		/**
		 * MIME type--multi-results
		 */
		public static final String CONTENT_TYPE = 
			"vnd.android.cursor.dir/vnd.google.labels";
		
		/**
		 * MIME type--single-result.
		 */
		public static final String CONTENT_ITEM_TYPE =
			"vnd.android.cursor.item/vnd.google.labels";
		
		/**
		 * label name
		 */
		public static final String NAME = "Name";
		
		/**
		 * sort id
		 */
		public static final String SORT_ID = "SORT_ID";
		
		public static final String DEFAULT_SORT_ORDER = SORT_ID + " DESC";
		
		
	}
	
	/**
	 * define columns in table item_label(association between an item and a label)
	 * <p>
	 * _id
	 * item_id
	 * label_id
	 *</p>
	 */
	public static final class Item_label implements BaseColumns
	{
		private Item_label(){}
		
		/**
		 * uri for table item_label
		 */
		public static final Uri CONTENT_URI = Uri.parse("content://"+AUTHORITY+"/item_label");
		
		
		/**
		 * MIME type--multiply results(may be not used)
		 */
		public static final String CONTENT_TYPE = 
			"vnd.android.cursor.dir/vnd.google.item_label";
		
		/**
		 * MIME type -- single results(may be not used)
		 */
		public static final String CONTENT_ITEM_TYPE = 
			"vnd.android.cursor.item/vnd.google.item_label";
		
		public static final String ITEM_ID = "Item_ID";
		
		public static final String LABEL_ID = "Label_ID";
		
		public static final String DEFAULT_SORT_ORDER = _ID + " DESC";
	}

}
